import com.coding.base.util.DateUtil;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.junit.Test;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;

/**
 * @auther wangchenghao
 * @date 2020/7/25
 **/

public class Utiltest {

    @Test
    public void testDateUtil() throws Exception {

        String date=DateUtil.getStringDate();
        System.out.println("date = " + DateUtil.getNow());
        Timestamp timeStamp = DateUtil.strToDateSql(date);
        System.out.println("timeStamp = " + timeStamp);

        DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
        DateTime compare_time=DateTime.parse(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(timeStamp),format);
        DateTime now_time=new DateTime();
        System.out.println("now_time = " + now_time);

        System.out.println("DateUtil.strToDateSql( DateUtil.getStringDate()) = " + DateUtil.strToDateSql(DateUtil.getStringDate()));
    }
}
